package com.bridgeintelligent.tag.webserver.security;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import lombok.Getter;

@Component
@Getter
public class SsoConfiguration {

    private String domain;

    private String port;

    private String clientId;

    private String contextPath;

    private String clientSecret;

    @Value("${sso.domain:tag-sso-server}")
    public void setDomain(String domain) {
        this.domain = domain;
    }

    @Value("${sso.port:8080}")
    public void setPort(String port) {
        this.port = port;
    }

    @Value("${sso.client-id:abc}")
    public void setClientId(String clientId) {
        this.clientId = clientId;
    }

    @Value("${sso.client-secret:abc}")
    public void setClientSecret(String clientSecret) {
        this.clientSecret = clientSecret;
    }

    @Value("${servet.context-path:}")
    public void setContextPath(String contextPath) {
        this.contextPath = contextPath.startsWith("/") && contextPath.endsWith("/")
        ? ""
        : contextPath;
    }

}
